<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>授信黑名单 详情</title>
<jsp:include page="../../import.jsp" flush="true"/>
</head>
<body>
        <form id="mcrCstBlackList_form">
           <div class="fieldset1 tabel_col tabel_col_s clearFix noBorder">
               <div class="fieldBox col_50">
                   <div class="label">客户ID</div>
                   <div class="field">
                       <span id="cstId" name="cstId"></span>
                   </div>
               </div>
               <div class="fieldBox col_50">
                   <div class="label">客户姓名</div>
                   <div class="field">
                       <span id="cstNm" name="cstNm"></span>
                   </div>
               </div>
               <div class="fieldBox col_50">
                   <div class="label">客户类型</div>
                   <div class="field">
                       <span id="cstTypeCd" name="cstTypeCd"></span>
                   </div>
               </div>
               <div class="fieldBox col_50">
                   <div class="label">操作类型</div>
                   <div class="field">
                       <span id="opCd" name="opCd"></span>
                   </div>
               </div>
               <div class="fieldBox col_50">
                   <div class="label">是否有效</div>
                   <div class="field">
                       <span id="isValid" name="isValid"></span>
                   </div>
               </div>
               <div class="fieldBox col_50">
                   <div class="label">禁用时间</div>
                   <div class="field">
                       <span id="forbiddenTmStr" name="forbiddenTmStr" class="ui-datepicker"></span>
                   </div>
               </div>
               <div class="fieldBox col_50">
                   <div class="label">禁用结束时间</div>
                   <div class="field">
                       <span id="forbiddenEndTmStr" name="forbiddenEndTmStr" class="ui-datepicker"></span>
                   </div>
               </div>
               <div class="fieldBox col_50">
                   <div class="label">原因</div>
                   <div class="field">
                       <span id="forbiddenReason" name="forbiddenReason"></span>
                   </div>
               </div>
               <!-- hide data -->
               <div class="fieldBox col_100" style="display:none;">
                   <div class="field">
                       <input name="dataId" id="dataId" type="text" class="ui-textbox" value="${id}">
                   </div>
               </div>
            </div>
        </form>
	<script>
		$(function() {
		   $("#mcrCstBlackList_form").ligerForm({
                validate: true
           });
	        
	       initData();
		});
		
		//父级窗口会调用取消
		frameElement.dialog.onCancel = function () {
			frameElement.dialog.close();
		}
		
		function initData(){
			var dataId = $("#dataId").val();
	    	if(StringUtils.isEmpty(dataId))return;
	    	var _url = '<%=path%>/mcr/mcrCstBlackList/getById.do';
	    	AjaxUtils.ajaxGet(_url, {id:dataId}, initCallback);
    	}
		
		//新增回调
		function initCallback(msg){
			if(msg.success == 1){
				 setData(msg.data);//设置数据
			 }else{
				 UIUtils.alertError(msg.info);
			 }
		}
		
		//设置页面数据
	    function setData(data){
            $("#cstId").html(data.cstId);
            $("#cstNm").html(data.cstNm);
	    	$("#forbiddenReason").html(data.forbiddenReason);
            if(data.cstTypeCd == '0'){
                $("#cstTypeCd").html("内部");
            }else if(data.cstTypeCd == '1') {
                $("#cstTypeCd").html("外部");
            }else if(data.cstTypeCd == '2') {
                $("#cstTypeCd").html("物流");
            }
            if(data.opCd == '0'){
                $("#opCd").html("系统");
            }else {
                $("#opCd").html("手动");
            }
	    	if(data.isValid == '1'){
                $("#isValid").html("是");
            }else {
                $("#isValid").html("否");
            }
	    	$("#forbiddenTmStr").html(renderDate(data.forbiddenTm));
	    	$("#forbiddenEndTmStr").html(renderDate(data.forbiddenEndTm));
		};

        // 格式化时间
        function renderDate(value){
            var dateStr = "";
            if(null != value){
                var date = new Date(value);
                dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
            }
            return dateStr;
        }
	</script>
</body>
</html>